<template>
    <div class="app-container">
        <div class="block">
            <el-row>
                <el-col :span="24">
                    <el-button type="success" icon="el-icon-plus" @click.native="add">{{ $t('button.add') }}</el-button>
                    <el-button type="primary" icon="el-icon-edit" @click.native="edit">{{ $t('button.edit') }}</el-button>
                    <el-button type="danger" icon="el-icon-delete" @click.native="remove">{{ $t('button.delete') }}</el-button>
                </el-col>
            </el-row>
        </div>


        <el-table :data="list" v-loading="listLoading" element-loading-text="努力加载中..." border fit highlight-current-row
                  @current-change="handleCurrentChange">
            <!--<el-table-column label="" show-overflow-tooltip width="50" align="center">
              <template slot-scope="scope">
                <el-radio :label="scope.row.id" v-model="form.id" @change.native="getTemplateRow(scope.$index,scope.row)">&nbsp></el-radio>
              </template>
            </el-table-column>-->
            <el-table-column label="序号" type="index" show-overflow-tooltip width="50" align="center">

            </el-table-column>
            <el-table-column label="社区名称" >
                <template slot-scope="scope">
                    {{scope.row.name}}
                </template>
            </el-table-column>
            <el-table-column label="省代码" v-if='false' >
                <template slot-scope="scope">
                    {{scope.row.provinceCode}}
                </template>
            </el-table-column>
            <el-table-column label="省名称">
                <template slot-scope="scope">
                    {{scope.row.provinceName}}/{{scope.row.cityName}}/{{scope.row.areaName}}
                </template>
            </el-table-column>
            <el-table-column label="市代码" v-if='false'>
                <template slot-scope="scope">
                    {{scope.row.cityCode}}
                </template>
            </el-table-column>
            <el-table-column label="市名称" v-if='false'>
                <template slot-scope="scope">
                    {{scope.row.cityName}}
                </template>
            </el-table-column>
            <el-table-column label="区代码"  v-if='false'>
                <template slot-scope="scope">
                    {{scope.row.areaCode}}
                </template>
            </el-table-column>
            <el-table-column label="区名称"  v-if='false'>
                <template slot-scope="scope">
                    {{scope.row.areaName}}
                </template>
            </el-table-column>
            <el-table-column label="街道">
                <template slot-scope="scope">
                    {{scope.row.street}}
                </template>
            </el-table-column>
            <el-table-column label="是否有影像文件" v-if='false'>
                <template slot-scope="scope">
                    {{scope.row.hasFile}}
                </template>
            </el-table-column>
            <!--<el-table-column label="创建人">
              <template slot-scope="scope">
                {{scope.row.createBy}}
              </template>
            </el-table-column>-->
            <el-table-column label="创建时间">
              <template slot-scope="scope">
                {{scope.row.createTime}}
              </template>
            </el-table-column>
        </el-table>

        <el-pagination
                background
                layout="total, sizes, prev, pager, next, jumper"
                :page-sizes="[10, 20, 50, 100,500]"
                :page-size="listQuery.limit"
                :total="total"
                @size-change="changeSize"
                @current-change="fetchPage"
                @prev-click="fetchPrev"
                @next-click="fetchNext">
        </el-pagination>

        <el-dialog
                :title="formTitle"
                :visible.sync="formVisible"
                width="70%">
            <el-form ref="form" :model="form" :rules="rules" label-width="150px">
                <el-row>
                    <el-col :span="12">
                        <el-form-item label="社区名称" prop="name" >
                            <el-input v-model="form.name" minlength=1></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="24">
                        <el-form-item label="省市区"  prop="address">
                            <li_area_select v-model="address" minlength=1></li_area_select>
                        </el-form-item>

                        <!--<el-form-item label="省代码"  >
                            <el-input v-model="form.provinceCode" minlength=1></el-input>
                        </el-form-item>-->
                    </el-col>
                    <!--<el-col :span="12">
                        <el-form-item label="省名称"  >
                            <el-input v-model="form.provinceName" minlength=1></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item label="市代码"  >
                            <el-input v-model="form.cityCode" minlength=1></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item label="市名称"  >
                            <el-input v-model="form.cityName" minlength=1></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item label="区代码"  >
                            <el-input v-model="form.areaCode" minlength=1></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item label="区名称"  >
                            <el-input v-model="form.areaName" minlength=1></el-input>
                        </el-form-item>
                    </el-col>-->
                    <el-col :span="24">
                        <el-form-item label="街道"  >
                            <el-input v-model="form.street" minlength=1></el-input>
                        </el-form-item>
                    </el-col>
                    <!--<el-col :span="12">
                        <el-form-item label="是否有影像文件"  >
                            <el-input v-model="form.hasFile" minlength=1></el-input>
                        </el-form-item>
                    </el-col>-->
                  <el-col v-show="false">
                    <el-form-item label="创建人"  >
                      <el-input v-model="form.createBy" minlength=1></el-input>
                    </el-form-item>
                  </el-col>
                  <el-col v-show="false">
                    <el-form-item label="创建时间">
                      <el-date-picker type="date" placeholder="选择日期" v-model="form.createTime" format="yyyy-MM-dd HH:mm:ss" value-format="yyyy-MM-dd HH:mm:ss">
                      </el-date-picker>
                    </el-form-item>
                  </el-col>
                </el-row>
                <el-form-item>
                    <el-button type="primary" @click="save">{{ $t('button.submit') }}</el-button>
                    <el-button @click.native="formVisible = false">{{ $t('button.cancel') }}</el-button>
                </el-form-item>

            </el-form>
        </el-dialog>
    </div>
</template>

<script src="./community_info.js"></script>

<style rel="stylesheet/scss" lang="scss" scoped>
    @import "src/styles/common.scss";
</style>

